package com.ysstech.kettle.enums;

import java.util.Arrays;
import java.util.Objects;

import com.ysstech.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 常量
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum KettleEnum implements BaseEnum<String> {
    KETTLE_REP_TYPE("KETTLE_REP_TYPE", "资源库类型"),
    KETTLE_DATABASE_TYPE("KETTLE_DATABASE_TYPE", "数据库类型");

    private final String code;
    private final String desc;

    public static KettleEnum getEnum(String code) {
        return Arrays.stream(values()).filter(b -> Objects.equals(b.code, code)).findFirst().orElse(null);
    }

    public static String getEnumDesc(String code) {
        KettleEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }
}
